package user;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import base.BaseDAO;



public class RegDAO extends BaseDAO{
    public RegDAO() {
        try {
            jbInit();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    private PreparedStatement pstmt;
    //private ResultSet rs;
    public void regUse(regBean rBean ){

    String uname=rBean.getName();
    String pwd=rBean.getPwd();
    //String repwd=rBean.getRepwd();
    try {
        conn = this.getConnection();
        String sq = "insert into [user] values(?,?,1,1)";
        pstmt = conn.prepareStatement(sq);
        pstmt.setString(1, uname);
        pstmt.setString(2, pwd);
        //pstmt.setString(3, repwd);
        pstmt.executeUpdate();

    } catch (Exception ex) {
        ex.printStackTrace();
    }finally{
        try{
                pstmt.close();
                conn.close();
            }catch(SQLException ex){
                ex.printStackTrace();
            }

    }

    }

    private void jbInit() throws Exception {
    }

}
